package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo01 {
    public static void main(String[] args) throws IOException {
        /*

         */
        FileInputStream in = new FileInputStream("./klxm.jpg");
        FileOutputStream out = new FileOutputStream("./klxm_cp.jpg");

        /*
        in = 01100111 10111101 11100111 00110001

        指针
        b=in.read();
        int b= 0000000 0000000 0000000 10111101
        out.write(b)
        out = 01100111 10111101
         */
        long t1 = System.currentTimeMillis();
        int b;
        while ((b=in.read())!=-1){//写出一个字节
            out.write(b);
        }
        in.close();
        out.close();
        long t2 = System.currentTimeMillis();
        System.out.println("复制完毕，耗时"+(t2-t1));

    }
}
